from numpy import dot array
class Node():
	nodeId = None	# node id which is used for reference
	baseClf = None	# basic classifier which is the nb classifier here
	featureLength = 2	# number of features we are using
	weight = None	# the weight used to give actual score
	children = []	# children nodes
	featureExtractor = None # extracts features from give data

	def predict(self, data):	# this is actually a binary classifier
									# but we use its score for internode 
									# comparison
		return dot(featureExtractor(data), weight)	# returns score

	def train(self, data, isIn):	#update weight according to hinge loss
		if predict(weight, data)*isIn>1:
			return
		weight+=isIn*features

	def __init__(self, featureNum, nodeID, baseCLF=None, childs):
		self.featureLength = featureNum
		self.nodeId = nodeID
		self.baseClf = baseCLF
		self.children = childs
		self.weight = array([0.0]*featureLength)

class path():
	path = [0]
	prob = 0.0

		